﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Data;
using Enterprise.DataFactory;
using Enterprise.Model.CaiWu;
using Enterprise.Infrastructure;
namespace Enterprise.Data.CaiWu
{
    public class CwTypeData
    {
        /// <summary>
        ///  数据列表
        /// </summary>
        /// <returns></returns>
        public List<CwTypeEntity> CwTypeList()
        {
            List<CwTypeEntity> list = new List<CwTypeEntity>();
            string cmd = "Select * from CWB_TYPE order by typeid asc";
            IDataReader dr = DbExecute.DataReader(cmd);
            while (dr.Read())
            {
                CwTypeEntity entity = new CwTypeEntity();
                if (!Convert.IsDBNull(dr["TYPEID"])) entity.TYPEID = Convert.ToInt32(dr["TYPEID"]);
                if (!Convert.IsDBNull(dr["TNAME"])) entity.TNAME = Convert.ToString(dr["TNAME"]);
                if (!Convert.IsDBNull(dr["TNAMERU"])) entity.TNAMERU = Convert.ToString(dr["TNAMERU"]);
                if (!Convert.IsDBNull(dr["TQZ"])) entity.TQZ = Convert.ToDecimal(dr["TQZ"]);
                list.Add(entity);
            }
            dr.Close();
            return list;
        }

        /// <summary>
        /// 数据操作方法
        /// </summary>
        /// <param name="cmd"></param>
        public void CwTypeExecute(string cmd)
        {
            DbExecute.Execute(cmd);
        }
    }
}
